home *** CD-ROM | disk | FTP | other *** search
-
-
- $(window).load(function() {
- var contheight = $('.softcontent').height() - 60;
- var navheight = $('.softnav ul').height();
- if (navheight < contheight) {
- $('.softnav ul').css('height', contheight + 'px');
- $('.softnav ul li:last-child').css('position','absolute');
- }
- });
- $( 'a.ui-open-file, a.ui-open-dir, a.ui-open-link').off('click').on('click', function ( event ) {
- var fileUrl = $( this ).attr( 'data-im-url' ),
- fileType = $( this ).attr( 'data-im-type' );
- switch( fileType ) {
- case 'file':
- openFile(fileUrl);
- break;
- case 'dir':
- openFileDir(fileUrl);
- break;
- case 'link':
- openLink(fileUrl);
- break;
- }
- return false;
- }).css({cursor: 'pointer'});
-
- var base = 'data';
- var gui = require('nw.gui');
- var win = gui.Window.get();
- //win.maximize();
-
- var path = require('path');
- var fs = require('fs');
-
-
- function openFile(file) {
- var fileInfo = getFilePath(base + file);
- if( fileInfo.fileExists ) {
- gui.Shell.openItem( fileInfo.filePath );
- }
- }
-
- function openFileDir(file) {
- var fileInfo = getFilePath(base + file);
- if( fileInfo.fileExists ) {
- gui.Shell.showItemInFolder( fileInfo.filePath );
- }
- }
-
- function setFilePath(file) {
- var filePath = path.join( path.dirname(process.execPath), file),
- fileExists = fs.existsSync( filePath ),
- result = {
- fileExists: fileExists,
- filePath: filePath
- };
- return result;
- }
-
- function openLink(url) {
- gui.Shell.openExternal( url );
- }
-
- function getFilePath(file) {
- return setFilePath(file);
- }
-
-
-